/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package coalescent.cef.pui;

import cef.event.Event;
import cef.event.Model_MLE_Event;
import cef.pui.EventConstructionException;
import cef.pui.EventImpl;
import cef.pui.pob.Builder;
import cef.pui.pob.StringBasedBuilder;
import coalescent.cef.pui.pob.Builders_Coa;
import coalescent.data.KC64Data;
import coalescent.model.KC64;
import commons.core.MultiLHoodComputer;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/**
 * Properties:
 * <ul>
 *     <li>{@code coalescent.builder.KC64List.theta.min = valid double string as specified in } {@link Double#parseDouble(java.lang.String)}</li>
 *     <li>{@code coalescent.builder.KC64List.theta.max = valid double string as specified in } {@link Double#parseDouble(java.lang.String)}</li>
 *     <li>{@code coalescent.builder.KC64List.theta.increment = valid double string as specified in } {@link Double#parseDouble(java.lang.String)}</li>
 *     <li>{@code coalescent.builder.KC64Data.theta = valid double string as specified in } {@link Double#parseDouble(java.lang.String)}</li>
 *     <li>{@code coalescent.builder.KC64Data.an = valid values are of the format f1^t1_f2^t2... where fi and ti are positive and represent the frequency domain, and the alleles on that frequency domain, respectively}</li>
 *     <li>{@code coalescent.builder.KC64MultiLHood.implCode = exact-recursion-multi}</li>
 * </ul>
 *
 * @since
 * @version
 * @author Susanta Tewari
 * @history Created on 2/23/13.
 */
public class KC64_MLE_EventImpl extends EventImpl
        implements Model_MLE_Event<KC64, KC64Data.DEFAULT> {

    private final Builder<List<KC64>> kc64List_b;
    private final StringBasedBuilder<KC64Data.DEFAULT> kc64Data_b;
    private final Builder<MultiLHoodComputer<KC64, KC64Data.DEFAULT, KC64Data.DEFAULT>> multi_LHood_b;

    public KC64_MLE_EventImpl(final Properties props) throws EventConstructionException {

        super(props);

        super.processEventProperties(getImplementedEventInterfaces());

        kc64List_b    = Builders_Coa.of_Models_KC64(props, null);
        kc64Data_b    = Builders_Coa.of_Data_KC64_Default(props, null);
        multi_LHood_b = Builders_Coa.of_MultiLHoodComputer_KC64(props, null);
    }

    @Override
    protected List<Class<? extends Event>> getImplementedEventInterfaces() {

        final List<Class<? extends Event>> result = new ArrayList<>(2);

        result.add(Model_MLE_Event.class);
        result.add(Event.class);

        return result;
    }

    @Override
    public List<KC64> getModels() {
        return kc64List_b.build();
    }

    @Override
    public KC64Data.DEFAULT getData() {
        return kc64Data_b.build();
    }

    @Override
    public MultiLHoodComputer<KC64, KC64Data.DEFAULT, KC64Data.DEFAULT> getMultiLHoodComputer() {
        return multi_LHood_b.build();
    }
}
